using UnityEngine;
using QFramework;
using UnityEngine.XR;
using Unity.Collections;

namespace ProjectindieFarm
{
	public partial class Plant : ViewController
	{
		public PlantStates mState = PlantStates.Seed;

        public PlantStates State => mState;

		public void SetState(PlantStates newState,int x,int y)
		{
			if(newState != mState)//更新
			{
				mState = newState;
				if(newState == PlantStates.Small)
				{

					GetComponent<SpriteRenderer>().sprite = ResConcoller.Instance.SmellPlantSprite;
				}else if(newState == PlantStates.Ripe)
				{
					GetComponent<SpriteRenderer>().sprite = ResConcoller.Instance.RipeSprite;
				}else if (newState == PlantStates.Seed)
				{
					GetComponent<SpriteRenderer>().sprite = ResConcoller.Instance.SeedSprite;
				
				}else if (newState == PlantStates.Old)
				{
					GetComponent<SpriteRenderer>().sprite = ResConcoller.Instance.OldSprite;

				}
				FindObjectOfType<Gridconller>().ShowGrid[x,y].PlantStates = newState;
			}
			
		}

		void Start()
		{
			// Code Here
		}
	}
}
